import requestFull from "./requestFull";

export default {
    // 统一库存交易接口
    submitTransaction(operationType, payload) {
        return requestFull({
            url: '/admin/inventory/transaction/submit',
            method: 'post',
            data: payload,
            headers: {
                'X-Operation-Type': operationType === 'inbound' ? '1' : '2' // 1-入库 2-出库
            }
        });
    },
    // 检查商品是否存在
    checkSku(params) {
        return requestFull({
            url: '/admin/inventory/check',
            method: 'get',
            params
        });
    },
    // 获取商品详情
    getSkuDetail(params) {
        return requestFull({
            url: '/admin/inventory/sku/detail',
            method: 'get',
            params
        });
    },
     // 获取出入库单分页数据
    getInventoryTransaction(params) {
      return requestFull({
        url: "/admin/inventory/getInventoryTransaction",
        method: "get",
        params,
        mock: false
      });
    },
  
    // 获取出入库单详情
    getInventoryTransactionDetails(params) {
      return requestFull({
        url: "/admin/inventory/getInventoryTransactionDetails",
        method: "get",
        params,
        mock: false
      });
    },
  
    // 确认或删除出入库单
    checkInventoryTransaction(params) {
      return requestFull({
        url: "/admin/inventory/checkInventoryTransaction",
        method: "get",
        params,
        mock: false
      });
    }
};